import { ajax } from '../http.js';
import { ajaxSync } from '../httpSync.js';

// 易生支付收款码相关
const getBankListUrl = '/easypay_dict/get_easypay_bank'; // 获取易生支付开户行列表
const getMccTypeUrl = '/easypay_dict/get_easypay_mcctype'; // 获取易生支付行业类型
const getUserTypeUrl = '/easypay_dict/get_easypay_user_type'; // 获取易生支付商户类型
const submitEasyPayInfoUrl = '/authc/easypay_info_input/submit'; // 录入易生支付信息
const getEasyPayInfoUrl = '/authc/easypay_info_input/find_info_input_by_userId'; // 查询易生支付收款码信息
const sendMessageUrl = '/authc/easypay_contract/send_message'; // 我要签约
const submitToCreateContractUrl = '/authc/easypay_contract/create_contract'; // 提交申请

// 店铺收款码相关
const getQrcodeInfoUrl = '/authc/user_store/store_collect_code'; // 获取店铺收款码地址
const getBankQrcodeUrl = '/authc/store_collect/find_by_user_id'; // 获取银行收款码信息
const getStepStatusUrl = '/authc/store_collect/find_by_user_id'; // 查看银联收款码各个状态

// 银联收款码相关
const getStoreNatureUrl = '/authc/user_store/find_all'; // 获取全部店铺类型
const getTradeAllUrl = '/trade/find_all'; // 获取全部行业类别
const getStoreInfoUrl = '/authc/user_store/find_user_rank_store'; // 查询未填写时商铺信息
const getLicenseInfoUrl = '/authc/business_license/find_info_by_userId'; // 获取未填写时营业执照信息
const getIdentityInfoUrl = '/authc/discern_identity/find_info_by_userId'; // 获取用户身份信息
const saveLicenseInfoUrl = '/authc/store_collect/save_qualification_info'; // 银联收款码营业执照提交
const saveLegalInfoUrl = '/authc/store_collect/save_legal_info'; // 银联收款码法人信息提交
const saveBankInfoUrl = '/authc/store_collect/save_bank_info'; // 银联收款码银行信息提交
const saveStoreInfoUrl = '/authc/store_collect/save_store_info'; // 银联收款码店铺信息提交
const getUserBankListUrl = '/authc/bankcard/find_bank_page'; // 获取银联银行卡列表
const getSubmitStoreInfoUrl = '/authc/store_collect/find_store_by_id'; // 获取银联收款码填取之后店铺信息
const getSubmitLicenseInfoUrl = '/authc/store_collect/find_qualification_by_id'; // 获取银联收款码填取之后的营业执照信息
const getSubmitLegalInfoUrl = '/authc/store_collect/find_legal_by_id'; // 获取银联收款码填取之后法人信息
const getSubmitBankInfoUrl = '/authc/store_collect/find_bank_by_id'; // 获取银联收款码填取之后银行信息
const getBankQrcodeFilesUrl = '/authc/store_collect/find_collect_contract_files'; //  查询收款码申请材料
const uploadContractPhotoUrl = '/authc/store_collect/upload_contract_photo'; // 上传纸质合同签字照片
const submitBankAllApplyInfoUrl = '/authc/store_collect/submit'; // 提交收款码全部信息

const getFeeUrl = '/authc/easypay_info_input/find_fee_type'; // 获取税率

// 推广码相关
const getPromQrcodeUrl = '/authc/user_rank/signin_qr_code'; // 获取推广码

const previewContractUrl = '/authc/easypay_contract/preview_contract'; // 预览易生电子协议

const previewContrac = (data, success, fail, opt) => { // 预览易生电子协议
  ajax({
    url: previewContractUrl,
    data: data,
    responseType: true,
    success: success,
    fail: fail,
    opt: opt
  });
};
const getFeeApi = (data, success, fail, opt) => { // 获取税率
  ajax({
    url: getFeeUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};

const getFeeApiSync = (data, success, fail, opt) => { // 获取税率
  return ajaxSync({
    url: getFeeUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};

const submitToCreateContractApi = (data, success, fail, opt) => { // 提交申请
  ajax({
    url: submitToCreateContractUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};

const sendMessageApi = (data, success, fail, opt) => { // 我要签约
  ajax({
    url: sendMessageUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};

const submitBankAllApplyInfoApi = (data, success, fail, opt) => { // 提交收款码全部信息
  ajax({
    url: submitBankAllApplyInfoUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};

const getBankQrcodeFilesApi = (data, success, fail, opt) => { // 查询收款码申请材料
  ajax({
    url: getBankQrcodeFilesUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};

const uploadContractPhotoApi = (data, success, fail, opt) => { // 上传纸质合同签字照片
  ajax({
    url: uploadContractPhotoUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};

const getSubmitBankInfoApi = (data, success, fail, opt) => { // 获取银联收款码填取之后银行信息
  ajax({
    url: getSubmitBankInfoUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};
const getSubmitLegalInfoApi = (data, success, fail, opt) => { // 获取银联收款码填取之后法人信息
  ajax({
    url: getSubmitLegalInfoUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};
const getSubmitLicenseInfoApi = (data, success, fail, opt) => { // 获取银联收款码填取之后的营业执照信息
  ajax({
    url: getSubmitLicenseInfoUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};
const getSubmitStoreInfoApi = (data, success, fail, opt) => { // 获取银联收款码填取之后店铺信息
  ajax({
    url: getSubmitStoreInfoUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};
const getStepStatusApi = (data, success, fail) => { // 查看银联收款码各个状态
  ajax({
    url: getStepStatusUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getUserBankListSyncApi = (data, success, fail) => { // 获取银联银行卡列表
  return ajaxSync({
    url: getUserBankListUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const saveStoreInfoApi = (data, success, fail, opt) => { // 银联收款码店铺信息提交
  ajax({
    url: saveStoreInfoUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};

const saveBankInfoApi = (data, success, fail, opt) => { // 银联收款码银行信息提交
  ajax({
    url: saveBankInfoUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};

const saveLegalInfoApi = (data, success, fail, opt) => { // 银联收款码法人信息提交
  ajax({
    url: saveLegalInfoUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};

const saveLicenseInfoApi = (data, success, fail, opt) => { // 银联收款码营业执照提交
  ajax({
    url: saveLicenseInfoUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};

const getStoreInfoSyncApi = (data, success, fail) => { // 同步查询商铺信息
  return ajaxSync({
    url: getStoreInfoUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getStoreInfoApi = (data, success, fail, opt) => { // 异步查询商铺信息
  ajax({
    url: getStoreInfoUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};

const getIdentityInfoSyncApi = (data, success, fail) => { // 同步获取法人身份证信息
  return ajaxSync({
    url: getIdentityInfoUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getLicenseInfoSyncApi = (data, success, fail) => { // 同步获取营业执照信息
  return ajaxSync({
    url: getLicenseInfoUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getPromQrcodeApi = (data, success, fail) => { // 获取推广码
  ajax({
    url: getPromQrcodeUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getEasyPayInfoApi = (data, success, fail, opt) => { // 查询易生收款码信息
  ajax({
    url: getEasyPayInfoUrl,
    data: data,
    success: success,
    fail: fail,
    opt: opt
  });
};

const getBankQrcodeApi = (data, success, fail) => { // 查询银行收款码信息
  ajax({
    url: getBankQrcodeUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getQrcodeInfoApi = (data, success, fail) => { // 查询收款码链接
  ajax({
    url: getQrcodeInfoUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const submitEasyPayInfoApi = (data, success, fail) => { // 提交易生支付信息
  ajax({
    url: submitEasyPayInfoUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getStoreNatureApi = (data, success, fail) => { // 获取全部店铺类型
  ajax({
    url: getStoreNatureUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getStoreNatureSyncApi = (data, success, fail) => { // 同步获取全部店铺类型
  return ajaxSync({
    url: getStoreNatureUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getTradeAllApi = (data, success, fail) => { // 获取全部行业类别
  ajax({
    url: getTradeAllUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getTradeAllSyncApi = (data, success, fail) => { // 同步获取全部行业类别
  return ajaxSync({
    url: getTradeAllUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getBankListApi = (data, success, fail) => { // 获取易生支付开户行列表
  ajax({
    url: getBankListUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getBankListSyncApi = (data, success, fail) => { // 同步获取易生支付开户行列表
  return ajaxSync({
    url: getBankListUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getMccTypeApi = (data, success, fail) => { // 获取易生支付行业类型
  ajax({
    url: getMccTypeUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getMccTypeSyncApi = (data, success, fail) => { // 同步获取易生支付行业类型
  return ajaxSync({
    url: getMccTypeUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getUserTypeApi = (data, success, fail) => { // 获取易生支付商户类型
  ajax({
    url: getUserTypeUrl,
    data: data,
    success: success,
    fail: fail
  });
};

const getUserTypeSyncApi = (data, success, fail) => { // 同步获取易生支付商户类型
  return ajaxSync({
    url: getUserTypeUrl,
    data: data,
    success: success,
    fail: fail
  });
};
export {
  getStoreNatureApi,
  getTradeAllApi,
  getBankListApi,
  getMccTypeApi,
  getUserTypeApi,
  getStoreNatureSyncApi,
  getTradeAllSyncApi,
  getMccTypeSyncApi,
  getUserTypeSyncApi,
  getBankListSyncApi,
  submitEasyPayInfoApi,
  getEasyPayInfoApi,
  getQrcodeInfoApi,
  getBankQrcodeApi,
  getPromQrcodeApi,
  getStoreInfoSyncApi,
  getLicenseInfoSyncApi,
  saveStoreInfoApi,
  saveBankInfoApi,
  saveLegalInfoApi,
  saveLicenseInfoApi,
  getUserBankListSyncApi,
  getStepStatusApi,
  getSubmitBankInfoApi,
  getSubmitLegalInfoApi,
  getSubmitLicenseInfoApi,
  getSubmitStoreInfoApi,
  getBankQrcodeFilesApi,
  uploadContractPhotoApi,
  submitBankAllApplyInfoApi,
  submitToCreateContractApi,
  sendMessageApi,
  getFeeApi,
  getFeeApiSync,
  getIdentityInfoSyncApi,
  getStoreInfoApi,
  previewContrac
};
